<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = [1,2,3,4,5,6,7,6,5,4,3,2,1,1,2,3,3,3,4,4]
        var arr1 = [];
        var obj = {};
        // for(var i=0; i<arr.length-1;i++){
        //     for(var j=i+1;j<arr.length;j++){
        //         if(arr[i] == arr[j]){
        //             arr.splice(j,1)
        //             j--
        //         }
        //     }
        // }
        // console.log(arr);
        // for(var i=0; i<arr.length;i++){
        //     if(obj[arr[i]] == undefined){
        //         obj[arr[i]] = 1
        //         arr1.push(arr[i]);
        //     }
        // }
        // console.log(arr1)
        arr1 = Array.from(new Set(arr));
        console.log(arr1)
    </script>
</body>
</html>